<template>
	<view class="adminBox">
		<view class="iconColor">
			<view class="iconBox">
				<uv-icon name="account" size="40"></uv-icon>
			</view>
			<view class="iconText" @click="toLogin">马上登录</view>
		</view>
		<view class="tipsBox">
			<view class="adminTips" v-for="(item,index) in typeArr" :key="item.id" @click="tipsPath(index)">
				<view class="tipsArrow">
					<uv-icon :name="item.icon" size="26"></uv-icon>
					<text>{{item.cont}}</text>
				</view>
				<uv-icon :name="item.arrow" size="26"></uv-icon>
			</view>
		</view>
	</view>
</template>
<script setup lang="ts">
	import { request } from "../../utils/request.js"
	const toLogin = () => {
		console.log("点击登陆");
		wx.login({
			success(res) {
				if (res.code) {
					request("/user/wx/login", "POST", { code: res.code }).then((data) => {
						uni.setStorageSync('loginStatus', 'true');
						uni.setStorageSync('wxLoginCode', data.data);
					})
				}
			}
		})
	}
	// 发起网络请求
	// wx.request({
	// 	url: 'http://172.16.129.45:8082/user/wx/login',
	// 	data: {
	// 		appid: "wx0317e2b294137b8d",
	// 		appsecret: "57a441b6ab8075557d64125ec1b98617",
	// 		code: res.code
	// 	},
	// 	method: 'POST',
	// 	success(res) {
	// 	},
	// 			fail(err) {
	// 				// 请求失败处理逻辑
	// 				console.log('请求失败！' + err.errMsg);
	// 			}
	// 	} else {
	// 		console.log('登录失败！' + res.errMsg)
	// 	}
	// }
	interface history {
		id : number,
		cont : string,
		icon : string,
		arrow : string
	}
	const typeArr : history[] = [
		{ id: 0, cont: '医生咨询', icon: 'kefu-ermai', arrow: 'arrow-right' },
		{ id: 1, cont: '查看报告', icon: 'eye', arrow: 'arrow-right' },
		{ id: 2, cont: '订单详情', icon: 'empty-favor', arrow: 'arrow-right' },
		{ id: 3, cont: '体检预约', icon: 'empty-news', arrow: 'arrow-right' },
		{ id: 4, cont: '支付详情', icon: 'red-packet', arrow: 'arrow-right' }
	]
	const tipsPath = (i) => { }
	// 	//console.log(typeArr[i].name);
	// 	switch (typeArr[i].cont) {
	// 		case '医生咨询':
	// 			uni.navigateTo({
	// 				url: "/page_report/report_examin/report_exmain"
	// 			});
	// 			break;
	// 		case '查看报告':
	// 			uni.navigateTo({
	// 				url: "/page_report/report_share/report_share"
	// 			});
	// 			break;
	// 		case '订单详情':
	// 			uni.navigateTo({
	// 				url: "/page_report/report_history/report_history"
	// 			});
	// 			break;
	// 		case '体检预约':
	// 			uni.navigateTo({
	// 				url: "/page_order/order_user/order_user"
	// 			});
	// 			break;
	// 		case '支付详情':
	// 			uni.navigateTo({
	// 				url: "/page_report/report_history2/report_history2"
	// 			});
	// 			break;
	// 	}
</script>

<style lang="less">
	.adminBox {
		background-color: #F4F6F6;

		.iconColor {
			display: flex;
			padding: 40rpx 0 40rpx 40rpx;
			background-color: #fff;

			.iconBox {
				width: 90rpx;
				height: 90rpx;
				border-radius: 50%;
				background-color: #F4F6F6;
			}

			.iconText {
				text-align: center;
				padding-top: 20rpx;
				padding-left: 20rpx;
			}
		}

		.tipsBox {
			background-color: #fff;
			margin-top: 80rpx;
			padding-top: 20rpx;

			.adminTips {
				display: flex;
				justify-content: space-between;
				margin-left: 20rpx;
				margin-top: 40rpx;
				border-bottom: 2rpx solid #aaa;
				padding-bottom: 10rpx;

				.tipsArrow {
					display: flex;
				}

				text {
					padding-left: 20rpx;
				}
			}
		}
	}
</style>